package com.spotmanger.project.modular.spottable.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.spotmanger.project.modular.spottable.entity.SpottablePolicyclosedEntity;
import com.spotmanger.project.modular.spottable.entity.SpottablePolicyclosedEntity;
import com.spotmanger.project.modular.spottable.mapper.SpottablePolicyclosedMapper;
import com.spotmanger.project.modular.spottable.mapper.SpottablePolicyclosedMapper;
import com.spotmanger.project.modular.spottable.service.SpottablePolicyclosedService;
import com.spotmanger.project.modular.spottable.service.SpottablePolicyclosedService;
import org.springframework.stereotype.Service;


@Service("spottablePolicyService")
public class SpottablePolicyclosedImpl extends ServiceImpl<SpottablePolicyclosedMapper, SpottablePolicyclosedEntity> implements SpottablePolicyclosedService {
    /**
     * 以TBBH为主,结合 LambdaQueryWrapper的模糊搜索方法。
     */
    @Override
    public LambdaQueryWrapper<SpottablePolicyclosedEntity> searchByTBBH(SpottablePolicyclosedEntity spottablePolicyclosed){
        LambdaQueryWrapper<SpottablePolicyclosedEntity> queryWrapper = Wrappers.lambdaQuery();
        if(spottablePolicyclosed.getTBBH()!=null){
            queryWrapper.like(SpottablePolicyclosedEntity::getTBBH,spottablePolicyclosed.getTBBH());
        }else {
            return queryWrapper;
        }
        return queryWrapper;
    }
}
